<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图书管理系统 - 图书列表</title>
    <style>
        /* 全局样式 */
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f5f6fa;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            font-size: 16px; /* 增大字号 */
        }

        /* 表格容器 */
        .table-container {
            width: 90%;
            max-width: 1000px;
            background-color: #ffffff;
            border-radius: 15px;
            box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }
         /* 标题样式 */
        .title-heading {
            font-family: 'Arial', sans-serif;
            font-size: 24px;
            color: #2c3e50;
            margin-top: 20px;
            text-align: center;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
        }

        /* 表格样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            table-layout: fixed;
        }

        th, td {
            padding: 15px 20px;
            text-align: left;
            position: relative;
            font-size: 16px; /* 增大字号 */
        }

        th {
            background-color: #4CAF50; /* 去掉渐变色 */
            color: white;
            font-weight: 600;
            text-transform: capitalize;
        }

        td {
            background-color: #f8f9fa;
            border-bottom: 1px solid #e9ecef;
        }

        /* 防止出版社内容换行 */
        td:nth-child(3) {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 200px;
        }

        /* 鼠标悬停动效 */
        tr:hover {
            background-color: #e9f5ff;
            transform: translateY(-2px);
            transition: all 0.3s ease;
        }

        /* 最后一行样式 */
        tr:last-child td {
            border-bottom: none;
        }

        /* 操作列样式 */
        .action-links a {
            color: #007bff;
            text-decoration: none;
            margin-right: 10px;
            font-weight: 500;
            transition: color 0.3s ease;
            font-size: 14px; /* 增大字号 */
        }

        .action-links a:hover {
            color: #0056b3;
            text-decoration: underline;
        }

        /* 动态加载效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        tr {
            animation: fadeIn 0.5s ease;
        }
    </style>
</head>
<body>
    <div class="table-container">
         <h1 class="title-heading">图书管理系统</h1>
        <table>
            <tr>
                <th>编号</th>
                <th>书名</th>
                <th>出版社</th>
                <th>价格</th>
                <th>商品零售价</th>
                <th>操作</th>
            </tr>
            {% for item in books %}
            <tr>
                <td>{{ item.id }}</td>
                <td>{{ item.title }}</td>
                <td>{{ item.pub }}</td>
                <td>{{ item.price }}</td>
                <td>{{ item.market_price }}</td>
                <td class="action-links">
                    <a href="http://127.0.0.1:8000/bookstore/update_book/{{item.id}}">修改</a> | <a href="http://127.0.0.1:8000/bookstore/delete_book?book_id={{ item.id }}">删除</a>
                </td>
            </tr>
            {% endfor %}

        </table>
    </div>
</body>
</html>